package com.zzhardy.controller;

import com.zzhardy.annotation.log.LogAccess;
import com.zzhardy.annotation.log.LogType;
import com.zzhardy.annotation.security.RemoteAccess;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 阡陌之中
 * @Description:测试
 * @date 2021/01/14
 */
@RequestMapping("/test")
@RestController
public class TestController {

    @RemoteAccess
    @RequestMapping("/normal")
    public Object normal() {
        return "普通访问，开发环境，进行打印日志记录";
    }
    
    @RequestMapping("/doError")
    @LogAccess(desc = "日志系统：注解异常测试", type = LogType.QUERY)
    public Object error(@RequestParam(value = "i", defaultValue = "1") int i, @RequestParam(value = "j", defaultValue = "0")int j) {
        return i / j;
    }
    
    @RequestMapping("/important")
    @LogAccess(desc = "日志系统：注解测试", type = LogType.QUERY)
    public Object important() {
        return "11注解形式，进行实时二次进行日子记录，此处，只记录重要日志时，进行注解使用";
    }
    
}
